<template>
  <div>
    <van-nav-bar title="频道管理" left-arrow />
    <div class="del">
      <h4>点击删除频道</h4>
      <div class="tabList">
        <span
          class="tab"
          v-for="item in list"
          :key="item.id"
          @click="tabFn(item.id)"
          >{{ item.name }}</span
        >
      </div>
    </div>
    <div class="add">
      <h4>点击添加频道</h4>
      <div class="tabList">
        <span class="tab">热点</span>
      </div>
    </div>
  </div>
</template>

<script>
import { category } from "../api/news";
export default {
  data() {
    return {
      list: [],
    };
  },
  created() {
    category().then((res) => {
      console.log(res);
      this.list = res.data.data;
    });
  },
  methods: {
    tabFn(id) {
      console.log(id);
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.van-nav-bar__left {
  .van-icon-arrow-left {
    color: #000;
  }
}
.del {
  margin-top: 20px;

  h4 {
    text-indent: 1em;
    font-weight: 900;
  }
  .tabList {
    margin: 40px;
    display: flex;
    flex-wrap: wrap;
    .tab {
      margin-right: 10px;
      border: 1px solid #ddd;
      padding: 10px;
      margin-top: 10px;
    }
  }
}
.add {
  margin-top: 20px;
  h4 {
    text-indent: 1em;
    font-weight: 900;
  }
  .tabList {
    margin: 40px;
    display: flex;
    flex-wrap: wrap;
    .tab {
      margin-right: 10px;
      border: 1px solid #ddd;
      padding: 10px;
      margin-top: 10px;
    }
  }
}
</style>